<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@ page language="java" contentType="image/jpeg ; charset=UTF-8"
    pageEncoding="UTF-8" import="java.awt.*,
java.awt.image.*,javax.imageio.*,java.io.*"%>
<%@ page import ="cn.edu.jsu.nrs.action.ImageAction"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
    response.setHeader("Pragma","No-cache");
    response.setHeader("Cache-Control","no-cache");
    response.setDateHeader("Expires", 0);

    ImageAction c = (ImageAction)WebApplicationContextUtils.getWebApplicationContext(getServletContext()).getBean("imageAction");
    BufferedImage  image = c.creatImage();
    OutputStream b = response.getOutputStream();
%>
<%ImageIO.write(image, "JPEG", response.getOutputStream());
 
    //必须添加以下两行否则tomcat下jsp出现getOutputStream() has already been called for this response异常
    out.clear();
    out = pageContext.pushBody();
    out.flush();
%>
</body>
</html>